- if is_officer?
  = error_messages_for("item")
  - form_for(:item, @item, :url => @form_url, :id => @item.id, :html => @form_method) do |form_for_item|
    %table
      %tr
        %td= @item.wowid
        %td= submit_tag("Sync", { :name => :sync })
      %tr
        %td Name
        %td= form_for_item.text_field(:name)
      %tr
        %td World of Warcraft ID
        %td= form_for_item.text_field(:wowid)
      %tr
        %td Default price
        %td
          = form_for_item.text_field(:default_price, :size => 8)
          - if @item.id
            Apply new price to loot records
            = check_box_tag(:update_history)
      %tr
        %td
        - if @item.id
          %td= submit_tag("Update")
        - else
          %td= submit_tag("Create")
  %br
- elsif @item
  %table
    %tr
      %th Name
      %td= @item.name
    %tr
      %th Default price
      %td= @item.default_price
  %br

- if (@item.nil? == false) and (@loot_records.nil? != true and @loot_records.length > 0)
  #lootHistory
    %h3 Loot history
    %table
      %th Looted by
      %th Date
      %th Comment
      %th Raid
      %th Mob
      %th Price
      - @loot_records.each do |record|
        %tr= render(:partial => record, :locals => { :loot => record })
  %br

- if (@items.length > 0)
  %table
    - @items.each do |item|
      %tr= render(:partial => item, :locals => { :item => item })

= will_paginate(@items)
